<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
    	String mJson = (String)request.getAttribute("mJson");
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">

$(function(){
	
	
	$.post(
	"/menuServlet",
	{},
	function(data){
		var s="";
		$.each(data,function(i,d){
			if(d.url=="0"){
				s+="<p><a href='javascript:;' onclick='getData("+d.id+")'>"+d.menuName+"</a></p>"
			}else{
				s+="<p><a href=\"javascript:;\" onclick=\"abc('"+d.url+"')\">"+d.menuName+"</a></p>"
			}
		});
		$("#menu").html(s);
	},
	"json"
	)
	
});

function getData(id){
	$.post(
			"/menuServlet",
			{menuId:id},
			function(data){
				var s="";
				$.each(data,function(i,d){
					if(d.url=="0"){
						s+="<p><a href='javascript:;' onclick='getData("+d.id+")'>"+d.menuName+"</a></p>"
					}else{
						s+="<p><a href=\"javascript:;\" onclick=\"abc('"+d.url+"')\">"+d.menuName+"</a></p>"
					}
				});
				$("#menu").html(s);
				
			},
			"json"
			)
	
}

function abc(url){
	window.open(url);
}

</script>
</head>
<body>

<div>

	<div style="float: left;" id="menu">
	<!-- 获取菜单数据 -->

	</div>


	<div style="float: right;">
	<%=request.getAttribute("username")%>
	欢迎您登陆！<a href="">注销</a>
	</div>


</div>

</body>
</html>